1boot1 <- dd[sample(seq(1, nrow(dd)), replace = TRUE), ]
2boot1$set <- 2
3p2 <- p1 +
geom_label(data = boot1,
position = position_jitter(height = 0.3, seed = 34),
color = "firebrick")
p2Rows: 9
Columns: 2
$ Species <chr> "Cercyonis pegala", "Colias philodice", "Erynnis persius", "Eu…
$ N <dbl> 26, 10, 1, 143, 44, 1, 59, 17, 7
\[H = -\sum_{i=1}^{N_{species}}{p_i}\ln({p_i})\] \(p_i\) is the relative abundance of the \(i\)th species
library(boot)
1bb_full <- rep(bb$Species, bb$N)
2shanH <- function(sp_list,indicies) {
sp_ab <- table(sp_list[indicies]) / length(sp_list)
return(-sum(sp_ab * log(sp_ab)))
}
3shan_bs <- boot(data = bb_full,
statistic = shanH,
R = 1000)Palma et al. 2022. New confidence interval methods for Shannon index.